<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <style>
        table {
            width: 80%;
            margin: 20px auto;
            border-collapse: collapse;
            font-family: Arial, sans-serif; /* 字体 */
        }

        th, td {
            border-bottom: 1px solid #ddd;
            border-left: 1px solid #ddd;
            border-right: 1px solid #ddd;
            padding: 10px;
            text-align: center; /* 中央对齐 */
        }
        td {
            color: #555;
        }
        body{
                position: relative;

        }
        #fenye{
            left: 45%;
            position: absolute;
            display: table-cell;
            vertical-align: middle;
            text-align: center;
        }
    </style>
</head>
<body>
<div th:replace="head"></div>
<div class="page-header">
    <div class="container">
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="page-caption">
                    <h2 class="page-title">菜品</h2>
                    <p>Healthy & delicious cuisine</p>
                </div>
            </div>
        </div>
    </div>
</div>
<table>
    <tr th:each="d:${page.list}">
        <td width="400"><img th:src="${d.img}" height="180" width="320"></td>
        <td  th:text="${d.name}" width="400"></td>
        <td th:text="${d.price}" width="350"></td>
        <td>
            <a th:href="@{'/cart/addtocart/'+${d.id}}">添加到购物车</a>
        </td>
    </tr>
</table>
<div id="fenye">
<p>
    当前第 <span th:text="${page.pageNum}"></span> 页,
    共 <span th:text="${page.pages}"></span> 页,
    共 <span th:text="${page.total}"></span> 条记录
</p>

    <a th:href="@{/dishes/getdishes}">首页</a>
    <a th:if="${page.hasPreviousPage}" th:href="@{/dishes/getdishes(pageIndex=${page.prePage})}">上一页</a>
    <a th:if="${page.hasNextPage}" th:href="@{/dishes/getdishes(pageIndex=${page.nextPage})}">下一页</a>
<a th:href="@{/dishes/getdishes(pageIndex=${page.pages})}">尾页</a>
<a th:href="@{/user/tomain}">返回</a></div><br><br><br><br><br>
    <div th:replace="footer"></div>
</body>
</html>